Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ctl): implement ctl regexes #1207

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

feat(ctl): implement ctl regexes #1207

wants to merge 1 commit into from

Conversation

jptosso
Copy link
Member

@jptosso jptosso commented Nov 8, 2024

@jptosso jptosso requested a review from a team as a code owner November 8, 2024 12:24
@jptosso jptosso marked this pull request as draft November 8, 2024 12:24
@jptosso jptosso linked an issue Nov 8, 2024 that may be closed by this pull request
}
value, col, ok := strings.Cut(ctlVal, ";")
var colkey, colname string
if ok {
colname, colkey, _ = strings.Cut(col, ":")
}
collection, _ := variables.Parse(strings.TrimSpace(colname))
colkey = strings.ToLower(colkey)
var re *regexp.Regexp
if len(colkey) > 2 && colkey[0] == '/' && colkey[len(colkey)-1] == '/' {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens here if the last / is escaped? Should not be treated as regex, right? E.g. /user/ ✅ , but /user\/ 💀 .

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indeed, have to fix it. We should have one unique function for that because we do this in multiple places

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Adds support for regex in ctl key
2 participants